package HomeWork.Work_01;

import java.util.Scanner;

/**
 * 输入某年某月某日，判断这一天是这一年的第几天？
 */
public class Date {
    public static void main(String[] args){
        date();
    }
    public static void date(){
        Scanner sc = new Scanner(System.in);
        System.out.print("请输入年份：");
        int year = sc.nextInt();
        System.out.print("请输入月份：");
        int m = sc.nextInt();
        System.out.print("请输入日期：");
        int d = sc.nextInt();
        int day = 0;
        if((0 == year % 4 && year % 100 != 0)||(0 == year % 400)){
            switch (m-1){
                case 11:
                    day += 30;
                case 10:
                    day += 31;
                case 9:
                    day += 30;
                case 8:
                    day += 31;
                case 7:
                    day += 31;
                case 6:
                    day += 30;
                case 5:
                    day += 31;
                case 4:
                    day += 30;
                case 3:
                    day += 31;
                case 2:
                    day += 29;
                case 1:
                    day += 31;
                default:
                    break;
            }
        }else{
            switch (m-1){
                case 11:
                    day += 30;
                case 10:
                    day += 31;
                case 9:
                    day += 30;
                case 8:
                    day += 31;
                case 7:
                    day += 31;
                case 6:
                    day += 30;
                case 5:
                    day += 31;
                case 4:
                    day += 30;
                case 3:
                    day += 31;
                case 2:
                    day += 28;
                case 1:
                    day += 31;
                default:
                    break;
            }
        }
        day += d;
        System.out.println("这天是这年的第：" + day + "天");
    }
}
